#include <stddef.h>
#include <string.h>
#include <stdio.h>
#include "z80.h"
#include "program.h"

void bzz80_sum(struct screen_device *screen, struct sio_device *sio)
{
    uint16_t s = 0;
    for (uint8_t i = 0; i < 100; i++) {
        char buf[32] = { 0 };
        sprintf(buf, "%d\n", s++);
        screen->print(buf);
        screen->update();
        sio->write(buf, strlen(buf));
        z80_delay_ms(50);
    }
}

void bzz_chess(struct screen_device *screen, struct sio_device *sio)
{
    char s1[] = { 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', '\n', 0 };
    char s2[] = { ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, '\n', 0 };
    char s3[] = { 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', '\n', 0 };
    char s4[] = { ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, '\n', 0 };
    char s5[] = { 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', '\n', 0 };
    char s6[] = { ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, '\n', 0 };
    char s7[] = { 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', '\n', 0 };
    char s8[] = { ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, ' ', 219, '\n', 0 };
    screen->print(s1);
    screen->print(s2);
    screen->print(s3);
    screen->print(s4);
    screen->print(s5);
    screen->print(s6);
    screen->print(s7);
    screen->print(s8);
}